<template>
  <div id="user-page">
    <!-- 个人用户信息头部展示开始 -->
    <user-info-header />
    <!-- 个人用户信息头部展示结束 -->

    <!-- 下部内容介绍开始 -->
    <div class="bottom">
      <!-- 左侧课程内容开始 -->
      <div class="lesson">
        <el-menu
          :default-active="activeIndex"
          active-text-color="#409EFF"
          class="el-menu-demo"
          mode="horizontal"
          @select="handleSelect"
        >
          <el-menu-item index="recentLesson">最近访问</el-menu-item>
          <el-menu-item index="likeLesson">收藏课程</el-menu-item>
          <el-menu-item index="mineLesson">我的课程</el-menu-item>
        </el-menu>

        <!-- 最近访问开始 -->
        <div class="lesson-content" v-if="activeIndex == 'recentLesson'">
          <div class="item" v-for="i of 8" :key="i">
            <learn-lesson-item />
          </div>
        </div>
        <!-- 最近访问结束 -->

        <!-- 收藏课程开始 -->
        <div class="lesson-content" v-else-if="activeIndex == 'likeLesson'">
          <div class="item" v-for="i of 8" :key="i">
            <learn-lesson-item />
          </div>
        </div>
        <!-- 收藏课程结束 -->

        <!-- 我的课程开始 -->
        <div class="lesson-content" v-else>
          <div class="item" v-for="i of 8" :key="i">
            <my-lesson-item />
          </div>
        </div>
        <!-- 我的课程结束 -->

        <!-- 分页 -->
        <div class="pagination">
          <el-pagination background layout="prev, pager, next" :total="1000">
          </el-pagination>
        </div>
      </div>
      <!-- 左侧课程内容结束 -->
      <!-- 右侧评论工具箱开始 -->
      <div class="tool-comment">
        <div class="tool item">
          <div class="title">工具箱</div>
          <div class="tool-box">
            <div class="box-item" @click="displayMyLesson">
              <div class="icon">
                <i class="bi bi-camera-fill"></i>
              </div>
              <div class="label">发布课程</div>
            </div>
            <div class="box-item">
              <div class="icon">
                <i class="bi bi-hammer"></i>
              </div>
              <div class="label">修改资料</div>
            </div>
            
            <div class="box-item" @click="myOrderPage">
              <div class="icon">
                <i class="bi bi-receipt"></i>
              </div>
              <div class="label">我的订单</div>
            </div>
          </div>
        </div>
        <div class="comment item">
          <div class="title">最近评论</div>
          <div class="content">
            <p @click="goRealCommentPage">
              深度学习框架caffe可以体现软件工程，时间快到了房间就是懒得看风景
            </p>
            <p @click="goRealCommentPage">今天你笑了吗？</p>
            <p @click="goRealCommentPage">加油(ง •̀_•́)ง</p>
            <p @click="goRealCommentPage">美术鉴赏</p>
          </div>
        </div>

        <!-- 最近回复开始 -->
        <div class="comment item">
          <div class="title">最近回复</div>
          <div class="content">
            <p @click="goRealCommentPage">
              深度学习框架caffe可以体现软件工程，时间快到了房间就是懒得看风景
            </p>
            <p @click="goRealCommentPage">今天你笑了吗？</p>
            <p @click="goRealCommentPage">加油(ง •̀_•́)ง</p>
            <p @click="goRealCommentPage">美术鉴赏</p>
          </div>
        </div>
        <!-- 最近回复结束 -->
      </div>
      <!-- 右侧评论工具箱结束 -->
    </div>
    <!-- 下部内容介绍结束 -->
  </div>
</template>

<script>
import LearnLessonItem from "../../components/lessons/LearnLessonItem.vue";
import LessonItem from "../../components/lessons/LessonItem.vue";
import MyLessonItem from "../../components/lessons/MyLessonItem.vue";
import UserInfoHeader from "../../components/user/UserInfoHeader.vue";
export default {
  components: {
    UserInfoHeader,
    LessonItem,
    LearnLessonItem,
    MyLessonItem,
  },
  data() {
    return {
      activeIndex: "recentLesson",
    };
  },
  methods: {
    // 定位到评论的视频位置
    goRealCommentPage() {
      this.$router.push("/video");
    },
    handleSelect(key, keyPath) {
      this.activeIndex = key;
    },
    myOrderPage() {
      this.$router.push("/order");
    },
    displayMyLesson() {
      this.$router.push("/createlesson");
    },
  },
};
</script>

<style scoped>
#user-page {
  background-color: #80808020;
}
#user-page .bottom {
  width: 85%;
  margin: 30px auto;
  background-color: transparent;
  display: flex;
  display: -webkit-flex;
  justify-content: space-between;
}

#user-page .bottom .lesson {
  width: 70%;
  background-color: #fff;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
  margin-bottom: 100px;
}

#user-page .bottom .lesson .pagination {
  width: 55%;
  margin: 40px auto;
}

#user-page .bottom .lesson .lesson-content {
  margin: 20px 0;
  display: flex;
  display: -webkit-flex;
  justify-content: start;
  flex-wrap: wrap;
}

#user-page .bottom .lesson .lesson-content .item {
  margin-right: 10px;
  margin-top: 15px;
}

#user-page .bottom .tool-comment {
  width: 23%;
  background-color: transparent;
  margin-bottom: 100px;
}
#user-page .bottom .tool-comment .comment {
  margin-top: 40px;
  width: 100%;
  background-color: #fff;
  border-radius: 10px;
  padding: 15px 0;
  box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
}
#user-page .bottom .tool-comment .tool {
  width: 100%;
  background-color: #fff;
  border-radius: 10px;
  padding: 15px 0;
  box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
}

#user-page .bottom .tool-comment .item .title {
  font-size: 14px;
  font-weight: bolder;
  margin-left: 10px;
  font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
}

#user-page .bottom .tool-comment .item .content {
  margin-top: 20px;
  color: gray;
  font-size: 12px;
  line-height: 20px;
  margin-left: 10px;
  font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
}

#user-page .bottom .tool-comment .item .content p {
  cursor: pointer;
  white-space: nowrap; /* 防止文本换行 */
  overflow: hidden; /* 隐藏超出div的内容 */
  text-overflow: ellipsis; /* 在超出部分显示省略号 */
}

#user-page .bottom .tool-comment .item .tool-box {
  display: flex;
  display: -webkit-flex;
  justify-content: start;
}

#user-page .bottom .tool-comment .item .tool-box .box-item {
  margin: 10px 5px;
  text-align: center;
  font-size: 13px;
  line-height: 20px;
  cursor: pointer;
}

#user-page .bottom .tool-comment .item .tool-box .box-item .icon i {
  font-size: 30px;
}
</style>
